Disable anki add button for 2.5s after click #2279
Open
+10
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Stops the user from accidentally double clicking the button or accidentally pressing the add hotkey twice. Button re-enable obv doesn't apply unless dupes/overwrite is allowed.
2.5s seems sane here to me but open to suggestions if this seems too much. If the user scans a word, adds it, scans another. Since the button is re-rendered, the second popup doesn't have any extra delay on adding.
Considered disabling then re-enabling after the card is created. But in some cases this could happen so fast that a user could still accidentally double click and end up adding two cards.